from django.conf.urls import url

from meiduo_admin.views import users, statistical,channels, skus, orders, permissions, specs, brands, goods, options

urlpatterns = [
    # 管理员登陆
    url(r'^authorizations/$',users.AdminAuthView.as_view()),
    #  总用户数
    url(r'^statistical/total_count/$',statistical.UserTotalCountView.as_view()),
    #  日增用户
    url(r'^statistical/day_increment/$',statistical.UserDayCountView.as_view()),
    #  日活跃量
    url(r'^statistical/day_active/$',statistical.UserActiveCountView.as_view()),
    # 日下单量
    url(r'^statistical/day_orders/$',statistical.UserOrderCountView.as_view()),
    # 月用户注册量
    url(r'^statistical/month_increment/$',statistical.UserMonthCountView.as_view()),
    # 商品列表访问量
    url(r'^statistical/goods_day_views/$',statistical.UserMonthCountView.as_view()),
    # 用户c查询
    url(r'^users/$', users.UserInfoView.as_view()),
    # 频道一级分类
    url(r'^goods/categories/$',channels.ChannelCategoriesView.as_view()),
    # 频道组
    url(r'^goods/channel_types/$', channels.ChannelTypesView.as_view()),
    # 图片管理
    url(r'^skus/simple/$', skus.SKUSimpleView.as_view()),
    # 测试
    # url(r'^skus/$',skus.SKUViewSet.as_view({'get': 'list'})),
    # 三级分类商品
    url(r'^skus/categories/',skus.SKUCategoriesView.as_view()),
    # SPU商品简单展示
    url(r'^goods/simple/$',skus.SPUSimpleView.as_view()),
    # SPU 商品规格展示
    url(r'^goods/(?P<pk>\d+)/specs/$',skus.SPUSpecView.as_view()),
    # 权限类型
    url(r'^permission/content_types/$', permissions.PermissionViewSet.as_view({'get': 'Content_types'})),
    # 用户组权限简单展示
    url(r'^permission/simple/$', permissions.GroupViewSet.as_view({'get':'Simple'})),
    # 管理员用户组简单展示
    url(r'^permission/groups/simple/$', permissions.AdminViewSet.as_view({'get': 'Simple'})),
    # 品牌简单展示
    url(r'^goods/brands/simple/$', goods.SPUViewSet.as_view({'get': 'Simple'})),
    # 一级分类展示
    url(r'^goods/channel/categories/$', goods.CategoriesView.as_view()),
    # 二 三级 分类展示
    url(r'^goods/channel/categories/(?P<pk>\d+)/$',goods.CategoryView.as_view()),
    # 规格简单展示
    url(r'^goods/specs/simple/$',options.OptionSimpleView.as_view()),
]

# 频道管理路由
from rest_framework.routers import DefaultRouter

router = DefaultRouter()

router.register('goods/channels', channels.ChannelsViewSet,base_name= 'channels')

urlpatterns += router.urls


# 图片管理路由
router = DefaultRouter()

router.register('skus/images', skus.SKUImageViewSet, base_name='images')

urlpatterns += router.urls

# SPU商品详情路由
router = DefaultRouter()

router.register('skus', skus.SKUViewSet, base_name='sku')

urlpatterns += router.urls


# 订单详情路由
router = DefaultRouter()

router.register('orders', orders.OrdersViewSet, base_name='orders')

urlpatterns += router.urls


# 用户权限管理路由
router = DefaultRouter()

router.register('permission/perms', permissions.PermissionViewSet, base_name='perms')

urlpatterns += router.urls

# 用户权限管理路由
router = DefaultRouter()

router.register('permission/groups', permissions.GroupViewSet, base_name='groups')

urlpatterns += router.urls

# 管理员用户管理路由
router = DefaultRouter()

router.register('permission/admins', permissions.AdminViewSet, base_name='admins')

urlpatterns += router.urls

# 规格管理路由
router = DefaultRouter()

router.register('goods/specs', specs.GoodSpecsViewSet, base_name='specs')

urlpatterns += router.urls

# 品牌管理路由
router = DefaultRouter()

router.register('goods/brands', brands.BrandViewSet, base_name='brands')

urlpatterns += router.urls


# SPU管理路由
router = DefaultRouter()

router.register('goods', goods.SPUViewSet, base_name='goods')

urlpatterns += router.urls

# 规格选项管理路由
router = DefaultRouter()

router.register('specs/options', options.OptionViewSet, base_name='options')

urlpatterns += router.urls
